package com.dfrz.ch06;

import com.sun.media.sound.SoftTuning;

/**
 * 作者：wangmaokang
 * 日期: 2021/4/13 11:23
 * 描述: 冒泡排序
 */
public class BubbleTest {

    public static void main(String[] args) {
        int[] ints={1111,2222,555,777,999,68,67,99,102,111};
        bubbleSort(ints);
        for (int anInt : ints) {
            System.out.print(anInt+",");
        }
    }

    public static void bubbleSort(int [] num){
        int temp;//中间值，用于替换
        for (int i=0;i<num.length-1;i++){
            for (int j=i+1;j<num.length;j++){
                if (num[i]>num[j]){
                    temp=num[i];
                    num[i]=num[j];
                    num[j]=temp;
                }
            }
        }

    }

}
